import { SWFModelInfo } from "./info/SWFModelInfo";
import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
type int = number;
//class SWFModelConfig
    
    export  class SWFModelConfig
    {
        constructor()
        {
            
            this._map = new Map<any, any> /* flash.utils.Dictionary */();
            this._codeMap = new Map<any, any> /* flash.utils.Dictionary */();
            if (SWFModelConfig._instance != null) 
            {
                throw new Error(" ResConfig 单例 ");
            }
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=null;
            var loc4=0;
            var loc5=arg1.modles;
            for(loc2 of loc5) 
            {
                this._codeMap[loc2.code] = loc2.isDiffCareer;
                var loc6=0;
                var loc7=loc2.modle;
                for(loc3 of loc7) 
                {
                    loc1 = new SWFModelInfo();
                    loc1.career = loc3.career;
                    loc1.modleType = loc2.modleType;
                    loc1.code = loc2.code;
                    loc1.sex = loc3.sex;
                    loc1.attackAction = loc3.attackAction;
                    loc1.mountAction = loc3.mountAction;
                    loc1.modle = loc3.modle;
                    loc1.stallAction = loc3.stallAction;
                    loc1.flyAction = loc3.flyAction;
                    loc1.sunBathAction = loc3.sunBathAction;
                    this._map[loc1.code + "" + loc1.career + loc1.sex] = loc1;
                }
            }
            return;
        }

        public init(): void
        {
            var loc1=ConfigManager.instance.getObjectByFileName("swfModle.xml");
            this.write(loc1);
            return;
        }

        public getInfoByCode(arg1: Object, arg2: int, arg3: int): string
        {
            if (this._codeMap[arg1]) 
            {
                return arg1 + "" + arg3 + arg2;
            }
            return arg1 + "0" + arg2;
        }

        public getModelInfo(arg1: Object): SWFModelInfo
        {
            return this._map[arg1];
        }

        public getSwfUrl(arg1: Object, arg2: int, arg3: int): string
        {
            var loc1=this.getInfoByCode(arg1, arg2, arg3);
            var loc2;
            if (loc2 = this.getModelInfo(loc1)) 
            {
                return loc2.modle;
            }
            return "";
        }

        public static get instance(): SWFModelConfig
        {
            if (SWFModelConfig._instance == null) 
            {
                SWFModelConfig._instance = new SWFModelConfig();
            }
            return SWFModelConfig._instance;
        }

        /* internal */ /* var */_map: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ /* var */_codeMap: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ static /* var */_instance: SWFModelConfig;
    }
